import type { ComponentType } from '@/components/Form/types';
import { IsInternalInterfaceEnum, IsRequired } from '@/enums/formEnum';

export interface FormGroupMapItem {
  id: number;
  name: string;
}

export interface FormItemVoMapItem {
  [x: number]: FormItemResult[];
}

/** 表单项 */
export interface FormItemResult {
  id: number;
  isRequired: IsRequired;
  disabled: boolean;
  isShow: 0 | 1;
  itemType: ComponentType;
  dataType?: string;
  /** 其他数据列表的对应ID, 用于高亮其他数据字段的交互逻辑 */
  fieldLibraryId?: number
  name: string;
  showName: string;
  type: string;
  value: string;
  /** 表单项默认值 */
  itemDefault?: string
  /** 是否查询数据源 */
  isInternalInterface: IsInternalInterfaceEnum;
  /** 接口控件数据源 */
  customFormItemAnswerList: { id: number; words: string }[];
  /** 表单value */
  formUserItemAnswerList: { content: string }[]
  formGroupId: number;
  /** 数据长度 */
  length: number;
  /** 多级控件的启用数量 */
  enableValue: number
  /** 关联当前Item的选项ID集合 */
  itemRelevanceAnsweIds?: number[]
}

export interface AddFormItemData {
  id: number | null;
  isRequired: IsRequired;
  itemType: ComponentType;
  name: string;
  showName: string;
  value: string
  fieldLibraryId?: string
  customFormItemAnswerDtoList?: { id: number | null; words: string }[];
}

export interface SubmitAnswerListItem {
  formItemId: number | string
  content: any[]
}